import { useState } from 'react'
import logo from './logo.svg'
import './App.css'

function App() {
  let [name,setName]=useState('杨祥')
  let [date,setDate]=useState(new Date().toLocaleTimeString());
  setInterval(()=>{
    setDate(new Date().toLocaleTimeString())
  },1000)
  const changename=()=>{
 setName('祥哥')
  
  }
  let friends=[{name:'yang',age:18},{name:'xiang',age:89}]
  return(
    <div>
   <h1>hello{name}</h1>
   <h2>{date}</h2>
   <button onClick={changename}>变个名字</button>
   <ul>{friends.map((friend,index)=><li key={index}>{friend.name}---{friend.age}</li>)}</ul>
    </div>
  )
}

export default App
